package com.example.lianguisystem.exceptionHandle;


import lombok.Data;

/**
 * @author jay
 * @Description: 自定义业务异常类
 * @date 2021/6/23 14:58
 */
@Data
public class BusinessExceptionNew extends RuntimeException {
    /**
     * 错误编码
     */
    private String code;
    public BusinessExceptionNew() {
        super();
    }
    public BusinessExceptionNew(String message) {
        super(message);
    }
    public BusinessExceptionNew(String code, String message) {
        super(message);
        this.code = code;
    }
    public BusinessExceptionNew(Throwable cause) {
        super(cause);
    }
    public BusinessExceptionNew(String message, Throwable cause) {
        super(message, cause);
    }
    public BusinessExceptionNew(String message, Throwable cause,
                                boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Override
    public String getMessage() {
        return super.getMessage();
    }
    @Override
    public String toString() {
        return this.code + ":" + this.getMessage();
    }
}
